<div class="modal-header">
    <span>{{ modalHeader }}</span>
    <button class="close" aria-label="Close" (click)="closeModal()">
        <span aria-hidden="true">&times;</span>
    </button>
</div>
<div class="modal-body">
    <form>
        <nb-card>
            <nb-card-header>
                试卷信息
            </nb-card-header>
            <nb-card-body>
                <div class="row">
                    <div class="col-sm-6">
                        <div class="form-group">
                            <label for="courseId">课程</label>
                            <select class="form-control" [(ngModel)]="paper.courseId" name="courseId" (change)="onCourseChange($event)">
                                <option *ngFor="let option of courseType" [value]="option.id">{{option.title}}</option>
                            </select>
                        </div>
                    </div>
                    <div class="col-sm-6">
                        <div class="form-group">
                            <label for="qbankId">题库</label>
                            <select class="form-control" [(ngModel)]="paper.qbankId" name="qbankId">
                                <option *ngFor="let option of qbankType" [value]="option.id">{{option.title}}</option>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label for="title">试卷名称</label>
                            <input type="text" class="form-control" id="title" name="title" placeholder="试卷名称" [(ngModel)]="paper.title">
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-6">
                        <div class="form-group">
                            <label for="paperDuration">考试时长</label>
                            <input type="number" class="form-control" id="paperDuration" name="paperDuration" placeholder="考试时长" [(ngModel)]="paper.paperDuration">
                        </div>
                    </div>
                    <div class="col-sm-6">
                        <div class="form-group">
                            <label for="difficulty">难度</label>
                            <input type="number" class="form-control" id="difficulty" name="difficulty" placeholder="难度" [(ngModel)]="paper.difficulty">
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label for="startTime">试卷有效期</label>
                            <!-- <input type="text" class="form-control" id="startTime" name="startTime" placeholder="试卷开始时间" [(ngModel)]="paper.startTime"> -->
                            <input class="form-control" id="termOfValidity" name="termOfValidity" placeholder="试卷有效期" bsDaterangepicker [(ngModel)]="paper.termOfValidity">
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-6">
                        <div class="form-group">
                            <label for="passScore">及格分数</label>
                            <input type="number" class="form-control" id="difficulty" name="passScore" placeholder="及格分数" [(ngModel)]="paper.passScore">
                        </div>
                    </div>
                    <div class="col-sm-6">
                        <div class="form-group">
                            <label for="remark">备注</label>
                            <input type="text" class="form-control" id="remark" name="remark" placeholder="备注" [(ngModel)]="paper.remark">
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-6" *ngIf="isEdit">
                        <div class="form-group">
                            <label for="status">状态</label>
                            <select class="form-control" [(ngModel)]="paper.status" name="status">
                                <option *ngFor="let option of statusType" [value]="option.name">{{option.val}}</option>
                            </select>
                        </div>
                    </div>
                </div>
                <!-- 题型循环遍历时候，绑定数据会出现问题，这里前端写死，后端的存储是json格式 -->
                <div class="row">
                    <div class="col-sm-6">
                        <div class="form-group">
                            <label for="single_choice">单选</label>
                            <input type="number" class="form-control" id="single_choice" name="single_choice" placeholder="单选" [(ngModel)]="paper.content.single_choice">
                        </div>
                    </div>
                    <div class="col-sm-6">
                        <div class="form-group">
                            <label for="multiple_choice">多选</label>
                            <input type="number" class="form-control" id="multiple_choice" name="multiple_choice" placeholder="多选" [(ngModel)]="paper.content.multiple_choice">
                        </div>
                    </div>
                    <div class="col-sm-6">
                        <div class="form-group">
                            <label for="true_false">判断</label>
                            <input type="number" class="form-control" id="true_false" name="true_false" placeholder="判断" [(ngModel)]="paper.content.true_false">
                        </div>
                    </div>
                    <div class="col-sm-6">
                        <div class="form-group">
                            <label for="fill_in_the_blanks">填空</label>
                            <input type="number" class="form-control" id="fill_in_the_blanks" name="fill_in_the_blanks" placeholder="填空" [(ngModel)]="paper.content.fill_in_the_blanks">
                        </div>
                    </div>
                    <div class="col-sm-6">
                        <div class="form-group">
                            <label for="short_answer">简答</label>
                            <input type="number" class="form-control" id="short_answer" name="short_answer" placeholder="简答" [(ngModel)]="paper.content.short_answer">
                        </div>
                    </div>
                    <div class="col-sm-6">
                        <div class="form-group">
                            <label for="case_analysis">案例分析</label>
                            <input type="number" class="form-control" id="case_analysis" name="case_analysis" placeholder="案例分析" [(ngModel)]="paper.content.case_analysis">
                        </div>
                    </div>
                </div>
            </nb-card-body>
        </nb-card>
        <nb-card *ngIf="previewHidden">
            <nb-card-header>
                试卷预览
            </nb-card-header>
            <nb-card-body>
                <ngx-previewq #previewq></ngx-previewq>
            </nb-card-body>
        </nb-card>
    </form>
</div>
<div class="modal-footer">
    <button class="btn btn-md" (click)="closeModal()">取消</button>
    <!-- <button class="btn btn-md btn-info" (click)="previewData()" *ngIf="previewHidden">预览</button> -->
    <button class="btn btn-md btn-primary" (click)="saveData()">保存</button>

</div>